<?php

/**
 * JingYao-backend
 *
 * @link     https://gitee.com/wang-zhihui-release/jingyao-backend
 * @apiDocument https://gitee.com/wang-zhihui-release/jingyao-backend/wikis/
 */

namespace Database\Factories;

use App\Models\Banner;
use Illuminate\Database\Eloquent\Factories\Factory;

class BannerFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = Banner::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
            'pic_url' => $this->faker->imageUrl(),
            'web_url' => 'https://www.baidu.com',
            'xcx_url' => (function () {
                $map = [
                    '/pages/suggestionBox/list/index',
                    '/pages/article/articleDetail/index?id=8',
                    '/pages/article/articleList/index?type=5',
                ];
                return $map[rand(0, count($map) - 1)];
            })(),
            'title' => $this->faker->title,
            'is_hide' => 'N',
            'identity_visibility' => 1,
            'push_time' => time() - rand(0, (7 * 24 * 3600)),
        ];
    }
}
